<div *ngIf="bought" class="progress-static top">
  <div class="progress-meter" [attr.data-value]="progress"></div>
</div>
<app-action-header
  [action]="autoBuy"
  [quantity]="autoBuy.quantity"
></app-action-header>

<div class="active-wrap">
  <clr-checkbox-wrapper>
    <input
      type="checkbox"
      clrCheckbox
      name="Active"
      [(ngModel)]="autoBuy.active"
      (change)="reload()"
    />
    <label>激活</label>
  </clr-checkbox-wrapper>
</div>

<div class="clr-row clr-justify-content-between" *ngIf="bought">
  <div class="clr-col">
    <label>优先级:</label>
    <input
      placeholder="Priority"
      name="name"
      [(ngModel)]="autoBuy.priority"
      type="number"
      placeholder="1"
      step="1"
      size="2"
      (change)="reload()"
    />
  </div>
  <div class="clr-col">
    <label>最大购买多个:</label>
    <clr-signpost>
      <clr-signpost-content *clrIfOpen>
        <h3 style="margin-top: 0">最大购买倍数</h3>
        <p>
          Multiply max available buy. (Es. 0.5 => half max). Use this to prevent
          production failure and/or save valuable resources. Range is 0 - 1
        </p>
      </clr-signpost-content>
    </clr-signpost>
    <div
      class="clr-control-container"
      [ngClass]="{
        'clr-error':
          autoBuy.priceSavePercent < 0 || autoBuy.priceSavePercent > 1
      }"
    >
      <input
        class="clr-input"
        placeholder="Priority"
        name="price_m"
        [(ngModel)]="autoBuy.priceSavePercent"
        type="number"
        placeholder="1"
        min="0"
        max="1"
        step="0.01"
        size="2"
      />
      <clr-icon class="clr-validate-icon" shape="exclamation-circle"></clr-icon>
    </div>
  </div>
</div>
<div class="clr-row clr-align-items-start" *ngIf="bought">
  <div class="clr-col">
    <span>
      时间间隔: <span class="monospace">{{ autoBuy.max }} </span> 秒
    </span>
    <span *ngIf="autoBuy.multiBuy.gt(1)">
      多重购买:
      <span class="monospace">{{ autoBuy.multiBuy | format: true }} </span>
    </span>
  </div>
</div>

<app-buttons [action]="autoBuy"></app-buttons>
